ajKafkaSendMessages function
Available since AlchemyJ v5.0
Description
The ajKafkaSendMessages function can send a set of messages to Kafka server, and you don't need to input formula in excel for each message. So, ajKafkaSendMessages is more convenient than ajKafkaSendMessage.
Please take note that to run this function from Excel, you would need to set up the Kafka Connection in ##ExternalResources.
Syntax
ajKafkaSendMessages(topic_name_list, message_list,[sync],[timeout],[kafka_connection_id],[run_condition],[run_by_function_point_only])
Argument Name | Argument Type | Description |
---|---|---|
topic_name_list (required) | Range | The topic name list for the Kafka message. |
message_list (required) | Range | The content of Kafka message from a range of cells. The range of cells can span multiple rows and columns, the content in cells that are in the same row will be concatenated. |
sync (optional) | Boolean | If it equals TRUE, it will wait Kafka finish the send action. If it equals FALSE, it will not wait Kafka finish the send action. The default value is FALSE. |
timeout (optional) | Integer | Usually, timeout (millisecond) is used together with sync when it is TRUE. |
kafka_connection_id (optional) | String | The parameter is used to define which Kafka shall be executed for the function. The default value is primary. |
run_condition (optional) | Boolean | The function will run when the value is TRUE. Otherwise, it will not run. The default value is TRUE. |
run_by_function_point_only (optional) | Boolean | If it equals FALSE, the function can be executed through ‘Excel Calculation’ (can be either Automatic or Manual, Calculate Now or Calculate Sheet) or Preview Function Point. If it equals TRUE, the function can be executed with Preview Function Point (AlchemyJ ribbon \ Preview Function Point) only. The default value is TRUE. |
The function will return:
1) Return Value: TRUE /FALSE+error message/ #VALUE!
2) Return Type: Single Value / Multiple values (array formula)
Prerequisite
Setup the Kafka connection in ##ExternalResources.
Example
Make sure the AlchemyJ Function Proxy was started up when executing ajKafkaSendMessages in the AlchemyJ workbook. You can start the proxy from More Tools - Run AlchemyJ Function Proxy.
Example 1
Send messages to Kafka server, all of the messages send successful, the result return TRUE.
The message can be retrieved in the defined Kafka server when the messages sent successful.
Example 2
When send the messages, if any one of message send failed, it will return FALSE with error message. For others send successful messages will return TRUE.
The message can be retrieved in the defined Kafka server.
Error Scenarios
It will return #VALUE! when missing any required parameter or mismatch parameter type in all records. Besides, system will raise error for below scenario(s).
Error Scenario |
---|
Kafka server connection timeout. |
Both of records topics are empty. |
Both of records messages are empty. |
The topic list size is not same with the message list size. |
Kafka connection does not exist. |